import { createRouter, createWebHistory } from 'vue-router'
import Home from '@/views/Home/index.vue'
import HomeInfo from '@/views/Home/components/HomeInfo.vue'
import Layout from '@/views/Layout/index.vue'
import Login from '@/views/Login/index.vue'
import Register from '@/views/Register/index.vue'
import Chat from '@/views/Chat/index.vue'
import ChartInfo from '@/views/Chat/components/ChatInfo.vue'
import Friend from '@/views/Friend/index.vue'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      redirect: '/friend/list',
      component: Layout,
      children: [
        {
          path: '/friend/list',
          // redirect: '/friend/list',
          component: Home,
          children: [{ path: '/friend/list/:friendId', component: HomeInfo }]
        },
        {
          path: '/chat/list',
          component: Chat,
          children: [{ path: '/chat/list/:friendId', component: ChartInfo }]
        },
        { path: '/share/list', component: Friend }
      ]
    },
    { path: '/register', component: Register },
    { path: '/login', component: Login }
  ]
})

export default router
